# Django settings for UsageSummary project.
from logging.handlers import SysLogHandler
import os

# You have to customize your properties files. Just make a copy from
# properties.py.template and change the parameters to adapt them to your needs.
import properties

#DEBUG = True
#TEMPLATE_DEBUG = DEBUG

DEBUG = getattr(properties, 'debug', False)
TEMPLATE_DEBUG = getattr(properties, 'template_debug', DEBUG)
SITE_ROOT = getattr(properties, 'site_root', 'http://localhost:8000/')
APP_ROOT = getattr(properties, 'app_root','.')
MANAGERS = getattr(properties, 'admins',( ('aaloy','aaloy@apsl.net'),))

ADMINS = (
    # ('Your Name', 'your_email@domain.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'sqlserver_ado', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'UsageSummary',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': 'HUUDUC310-PC',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
        'OPTIONS' : {
            'provider': 'SQLOLEDB',
            'use_mars': True,
        },
    }
}
DIRNAME = os.path.dirname(__file__)
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
#TIME_ZONE = 'America/Chicago'
TIME_ZONE = getattr(properties,'time_zone','America/Chicago')

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
#LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = getattr(properties, 'language_code', 'en-us')

#SITE_ID = 1
SITE_ID = getattr(properties, 'site_id', 1)

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
#USE_I18N = True
USE_I18N = getattr(properties,'use_i18n',True)

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
#USE_L10N = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/"
#MEDIA_ROOT = os.path.abspath(os.path.join(DIRNAME, 'media'))
MEDIA_ROOT = getattr(properties, 'media_root', APP_ROOT+r'/media/')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
#MEDIA_URL = '/media/'
MEDIA_URL = getattr(properties, 'media_url', 'http://localhost:8000/media/')

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
#ADMIN_MEDIA_PREFIX = '/media/'
ADMIN_MEDIA_PREFIX = getattr(properties, 'admin_media_prefix', '/adm_media/')

# Make this unique, and don't share it with anybody.
#SECRET_KEY = 'p+*30x3n^in-302db*4*5an29+x+i8hwnm!!+gx&421ujz@!&q'
SECRET_KEY = getattr(properties, 'secret_key', 'default-secret-key-o-yeah!')

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    #'django.template.loaders.filesystem.Loader',
    #'django.template.loaders.app_directories.Loader',
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    #'django.middleware.csrf.CsrfViewMiddleware',
    #'django.contrib.auth.middleware.AuthenticationMiddleware',
    #'django.contrib.messages.middleware.MessageMiddleware',
    #'django.middleware.csrf.CsrfViewMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.doc.XViewMiddleware',
    'django.middleware.gzip.GZipMiddleware',
)

#ROOT_URLCONF = 'UsageSummary.urls'
ROOT_URLCONF = 'urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    #os.path.join( os.path.dirname(__file__ ), "templates" ),
    APP_ROOT+'/templates/',
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'ReportApp',
    'django.contrib.admin',
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)

# cache and session backend
CACHE_BACKEND=getattr(properties, 'cache_backend', 'file:///tmp/jq_agenda_cache')
CACHE_MIDDLEWARE_KEY_PREFIX=getattr(properties, 'cache_prefix', 'app_fuse')
CACHE_MIDDLEWARE_SECONDS=getattr(properties, 'cache_seconds', 3600)
SESSION_ENGINE=getattr(properties, 'session_engine', 'django.contrib.sessions.backends.cache')

if DEBUG:
    SESSION_EXPIRE_AT_BROWSER_CLOSE=True
  

ugettext = lambda s:s
LANGUAGES = (
    ('en', ugettext('English')),
    ('es', ugettext('Spanish')),
    ('ca', ugettext('Catalan')),
)


TEMPLATE_CONTEXT_PROCESSOR = (
    #'django.core.context_processors.debug',
    #'django.core.context_processors.i18n',
    #'django.core.context_processors.media',
    #'django.core.context_processors.static',
    #'django.contrib.auth.context_processors.auth',
    #'django.contrib.messages.context_processors.messages',
    "django.core.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.request"
)

COPYRIGHT="apsl.net"